<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Message extends Model
{
    //关联表
    protected $table = 'messages';
    //主键
    public $primaryKey = 'id';
    //设置timesatmps为开启
    public $timestamps = true;

    public function user()
    {
        return $this->belongsTo('App\User');
    }

    public function post()
    {
        return $this->belongsTo('App\Post');
    }
}
